<?php
$this->pageHeader = t('PAGE_TITLE',  'advanceProfile');
$this->pageTitle = t('PAGE_TITLE','advanceProfile');
$toolbar = new LGToolbar();
$toolbar->ButtonSave(t('BTN_SAVE', 'profile'), '#advanceprofile-form', ActionType::SAVE);
$toolbar->buttonNewPage(t('BTN_EDIT_TRANSLATED', 'profile'), '', '/translate/index/', array("id" => $modelProfile->id,"alias"=>stringURLSafe($modelProfile->full_name)));
$toolbar->buttonDetail(t('BTN_DETAIL','profile'), t('BTN_DETAIL','profile'), 'buttonDetail', '', "translate/detail", array("id" => $modelProfile->id,"alias"=>stringURLSafe($modelProfile->full_name)));
$toolbar->Cancel('btnCancel',t('BTN_CANCEL'),url('/profile/index/'));
$this->pageToolbar = $toolbar->mergeToolbar();
?>
<?php
$form = $this->beginWidget('CActiveForm', array(
        'id' => 'advanceprofile-form',       
        'enableAjaxValidation'=>false,
        'enableClientValidation'=>true,
        'clientOptions' => array('validateOnSubmit'=>true, 'validateOnType'=>true),
        'htmlOptions' => array('enctype' => 'multipart/form-data'),
        ));
?>
<div class="advance profile">
<?php    
	$this->renderPartial('_personalinformation', array('model' => $model, 'modelProfile' => $modelProfile, 'form' => $form));
?>
</div>
<?php $this->endWidget(); ?>
<?php $this->widget('ext.EUpdateFileDialog.EUpdateFileDialog', array('dialogOptions' => array('resizable' => false))); ?>

<script type="text/javascript">
	$('#btnCancel').attr('onclick', '');
	$('#btnCancel').click(function(){
		LGCMS.kAlert('Thông báo', 'Bạn có muốn lưu dữ liệu trước khi thoát khỏi trang? <p style="text-align:center"><br /> <input type="button" class="button" value="Có" onclick="saveAndClose();"> <input type="button" class="button" value="Không" onclick="gotoGrid();"> <input type="button" class="button" value="Hủy" onclick="LGCMS.kAlertClose();"></p>', 400, 150);		
	});
	function saveAndClose(){
		LGCMS.kAlertClose();
		LGCMS.setTask('#advanceprofile-form', 'saveclose');
	};
	function gotoGrid()
	{
		window.location.href = '<?php echo url('/profile/index')?>';
	}
</script>